import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import '@/styles/index.less'
import App from './App.vue'
import router from './router'
// svg插件配置
import 'virtual:svg-icons-register'
// 引入自定义插件对象 注册全局组件
import globalComponent from '@/components'
// 暗黑模式 css
import 'element-plus/theme-chalk/dark/css-vars.css'

const pinia = createPinia() //创建pinia实例
pinia.use(piniaPluginPersistedstate) //将插件添加到 pinia 实例上
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(ElementPlus, {
  locale: zhCn
})
app.use(globalComponent)
app.use(pinia)
app.use(router)
// 引入路由鉴权
import './permisstion'
app.mount('#app')
